<?php
namespace app\api\controller;

use app\common\controller\Common;
use think\Controller;
use think\Request;

/**
 * @title 配置接口文档
 * @description 接口说明
 * @group 接口分组
 *
 */
class Config extends Common
{
    /**
     * @title 获取配置
     * @description 接口说明
     * @author WCJ
     * @url /api/config/getwebconfig
     * @method GET
     *
     *
     * @return web_title: 网站标题
     * @return img_url: 图片前缀链接
     *
     *
     */
    public function getwebconfig(Request $request){

        $suifei = db("config")->where("name","new_tax")->value("data");
        $fuwufei = db("config")->where("name","new_service")->value("data");
        return ["suifei"=>$suifei,"fuwufei"=>$fuwufei];
    }

    /**
     * @title 获取角色
     * @description 接口说明
     * @author WCJ
     * @url /api/config/getRole
     * @method GET
     *
     *
     * @return id:自增ID
     *
     *
     */
    public function getRole(Request $request){

        $data = db("user_role")->select();
        foreach ($data as $key=> $va){
            $data[$key]["description"]=json_decode($data[$key]["description"]);
        }
        return $data;
    }
}